# Copyright 2024 The secretflow authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:psi.bzl", "psi_cc_binary", "psi_cc_library", "psi_cc_test")

package(default_visibility = ["//visibility:public"])

psi_cc_library(
    name = "ggm_pset",
    srcs = ["ggm_pset.cc"],
    hdrs = ["ggm_pset.h"],
    deps = [
        "@yacl//yacl/base:dynamic_bitset",
        "@yacl//yacl/crypto/rand",
        "@yacl//yacl/crypto/tools:prg",
    ],
)

psi_cc_library(
    name = "client",
    srcs = ["client.cc"],
    hdrs = ["client.h"],
    deps = [
        ":ggm_pset",
        "@yacl//yacl/base:dynamic_bitset",
        "@yacl//yacl/base:exception",
        "@yacl//yacl/crypto/rand",
        "@yacl//yacl/crypto/tools:prg",
    ],
)

psi_cc_library(
    name = "server",
    srcs = ["server.cc"],
    hdrs = ["server.h"],
    deps = [
        ":ggm_pset",
        "@yacl//yacl/base:dynamic_bitset",
        "@yacl//yacl/crypto/rand",
        "@yacl//yacl/crypto/tools:prg",
    ],
)

psi_cc_library(
    name = "sender",
    srcs = ["sender.cc"],
    hdrs = ["sender.h"],
    deps = [
        ":ggm_pset",
        "@yacl//yacl/base:dynamic_bitset",
        "@yacl//yacl/link:context",
    ],
)

psi_cc_library(
    name = "receiver",
    srcs = ["receiver.cc"],
    hdrs = ["receiver.h"],
    deps = [
        ":ggm_pset",
        "@yacl//yacl/base:dynamic_bitset",
        "@yacl//yacl/link:context",
    ],
)

psi_cc_test(
    name = "pps_test",
    srcs = ["ggm_pset_test.cc"],
    deps = [
        ":ggm_pset",
    ],
)

psi_cc_test(
    name = "pps_pir_test",
    srcs = ["pps_pir_test.cc"],
    deps = [
        ":client",
        ":receiver",
        ":sender",
        ":server",
        "@yacl//yacl/base:dynamic_bitset",
        "@yacl//yacl/link",
    ],
)

psi_cc_binary(
    name = "pps_pir_benchmark",
    srcs = ["pps_pir_benchmark.cc"],
    deps = [
        ":client",
        ":receiver",
        ":sender",
        ":server",
        "@com_github_google_benchmark//:benchmark_main",
        "@yacl//yacl/base:dynamic_bitset",
        "@yacl//yacl/link",
    ],
)
